package com.lims.dao.common.impl;

import java.util.List;


import com.lims.dao.base.BaseDAOImpl;
import com.lims.dao.common.ISampleDAO;
import com.lims.po.common.Sample;

public class SampleDAOImpl extends BaseDAOImpl<Sample> implements ISampleDAO {
	private static final String className=SampleDAOImpl.class.toString();
	public List<Sample> selectAll(){
		String hql="from Sample order by pid";
		return super.ExecuteQuery(hql, className+"-->selectAll()");
	}
	public boolean saveSample(Sample sample){
		return super.saveObject(sample, className+"-->saveSample(Sample Sample)")>0?true:false;
	}
	public boolean updateSample(Sample sample){
		return super.updateObject(sample, className+"-->updateSample(Sample Sample)");
	}
	public boolean deleteSample(Sample sample){
		return super.deleteObject(sample, className+"-->deleteSample(Sample Sample)");
	}
	public boolean selectSampleBySampleTitle(String SampleTitle){
		String hql="from Sample where SampleName='"+SampleTitle+"'";
		return super.ExecuteQuery(hql, className+"-->selectSampleBySampleName(String SampleName)").size()==0?false:true;
	}
	public boolean deleteSampleById(int pid){
		String hql="delete from Sample where pid="+pid;
		return super.ExecuteNonQuery(hql, className+"-->deleteSampleById(int pid)");
	}
	
	public Sample selectSampleById(int pid) {
		return super.selectById(pid, className+"-->selectSampleById(int pid)");
	}
}
